package com.ghck.shop.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.ghck.shop.dao.provider.GoodsSpecificationMapperProvider;
import com.ghck.shop.model.GoodsSpecification;

public interface GoodsSpecificationMapper {

	@Select("select * from t_good_specification where good_id=#{goodId} and status = 1")
	public List<GoodsSpecification> findGoodsSpecificationsByGoodId(Integer goodId);
	
	@Select("select * from t_good_specification where good_id=#{goodId}")
	public List<GoodsSpecification> findGoodsSpecificationsByGoodIdAll(Integer goodId);
	
	@InsertProvider(type=GoodsSpecificationMapperProvider.class,method="batchSaveGoodsSpecifications")
	public void batchSaveGoodsSpecifications(List<GoodsSpecification> list);
	
	@Select("select * from t_good_specification where id=#{id} ")
	public GoodsSpecification findGoodsSpecificationById(@Param("id")Integer id);
	
	@Delete("delete from t_good_specification where id=#{id}")
	public Integer deleteGoodsSpecificationById(@Param("id")Integer id);
	
	@DeleteProvider(type=GoodsSpecificationMapperProvider.class,method="deleteGoodsSpecificationByGoodIdAndNotIds")
	public Integer deleteGoodsSpecificationByGoodIdAndNotIds(@Param("goodId")Integer goodId,@Param("ids")List<Integer> ids);
	
	@UpdateProvider(type=GoodsSpecificationMapperProvider.class,method="update")
	public Integer update(GoodsSpecification goodsSpecification);
	
	
	@SelectProvider(type=GoodsSpecificationMapperProvider.class,method="findGoodsSpecificationsByGoodIds")
	public List<GoodsSpecification> findGoodsSpecificationsByGoodIds(List<Integer> goodIds);
	
	@SelectProvider(type=GoodsSpecificationMapperProvider.class,method="findGoodsSpecificationsByIds")
	public List<GoodsSpecification> findGoodsSpecificationsByIds(List<Integer> ids);
}
